1103dd565eb36bbb9d18ebddc16ffafc973282bc,main/java/PowerPaint/src/com/kreative/paint/tool/CalligraphyBrushTool.java,CalligraphyBrushTool,mouseDragged,#ToolEvent#,106
Before Change
}
public boolean mouseDragged(ToolEvent e) {
if (brushCache == null) makeCache(e);
PaintSettings ps = e.getPaintSettings();
Graphics2D g = e.getPaintGraphics();
float x = e.getX();
float y = e.getY();
float px = e.getPreviousX();
float py = e.getPreviousY();
int i = (int)Math.hypot(px-x, py-y);
if (i >= brushCache.length) i = brushCache.length-1;
ps.applyFill(g);
if (ccache) {
drag(e.getPaintSurface(), g, px, py, x, y, bi, i);
} else {
Bitmap brush = brushCache[bi = i];
x -= brush.getWidth()/2;
y -= brush.getHeight()/2;
brush.paint(e.getPaintSurface(), g, (int)x, (int)y);
}
return true;
}
After Change
return true;
}
public boolean mouseDragged(ToolEvent e) {
Graphics2D g = e.getPaintGraphics();
e.getPaintSettings().applyFill(g);
float x = e.getX();
float y = e.getY();
float px = e.getPreviousX();
float py = e.getPreviousY();
int i = (int)Math.hypot(px - x, py - y);
Sprite brush = e.tc().getCalligraphyBrush();
int n = brush.getChildCount();
if (i >= n) i = n - 1;
if (e.tc().calligraphyContinuous()) {
drag(brush, g, px, py, x, y, bi, i);
} else {
brush.getChild(bi = i).paint(g, (int)x, (int)y);